<template>
     <span @click="clearDraw">清除测量</span>
</template>
<script setup>
import { ref, getCurrentInstance, onMounted } from "vue";
const { proxy } = getCurrentInstance();
import { usePopupStore } from "@/stores/popupStore";
const { hidePopup } = usePopupStore();
const $map = ref(null);
const clearDraw = () => {
    $map.value = proxy.$map;
    const layers= $map.value.getLayers().getArray();
    //console.log(layers)
    layers.forEach(layer=>{
        if(layer.get('id')=='draw-area-layer' || layer.get('id')=='draw-line-layer'){
            layer.getSource().clear();
        }
    })
    hidePopup();
}
</script>
<style scoped>

</style>